<template>
  <view class="container">
	  <view class="header">
	  	<uni-icons  fontFamily="iconfont" @click="goBack" :size="24" color="#666">{{'\ue64f'}}</uni-icons>
	  	<view class="title">个人信息</view>
	  </view>
    <uni-list>
      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'person-filled'}" title="用户名称" :rightText="user.userName" />
      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'phone-filled'}" title="手机号码" :rightText="user.tel" />
	  <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="性别" :rightText="user.gender == 'f' ? '女': '男'" />
	  <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="所属部门" :rightText="user.departMent.deptName" />
	  <uni-list-item showExtraIcon="true" :extraIcon="{type: 'auth-filled'}" title="就任岗位" :rightText="user.post.postName" />
	  <uni-list-item showExtraIcon="true" :extraIcon="{type: 'auth-filled'}" title="考核分数" :rightText="''+user.score" />
	   <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="在职企业" :rightText="user.company" />
	   <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="在职状态" :rightText="user.empStatus == 0 ? '在职': '离职'" />
	  <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="是否管理员" :rightText="user.isAdmin == 1 ? '管理员': '普通员工'" />
      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="入职日期" :rightText="user.hireDate" />
    </uni-list>
  </view>
</template>

<script>
  import { getInfo } from "@/api/user"
  import uniListItem from '@/components/uni-list/components/uni-list-item/uni-list-item.vue'
  import uniList from '@/components/uni-list/components/uni-list/uni-list.vue'
  import AuthApi from '@/utils/auth'
  export default {
	  components:{
		  uniList,
		  uniListItem
	  },
    data() {
      return {
        user:""
        // roleGroup: "",
        // postGroup: ""
      }
    },
    onLoad() {
	   // const  user = uni.getStorageSync("userInfo")
    //    user?.userId && this.getUser(user.userId)
         this.user = AuthApi.getUser()
		 if(!this.user.departMent) {
		 	this.user.departMent = {
		 		departId: "",
		 		deptName: ""
		 	}	
		 }
		 
		 if(!this.user.post) {
		 	this.user.post = {
		 		postId: "",
		 		postName: ""
		 	}	
		 }
		 console.log( this.user)
    },
    methods: {
      getUser(userId) {
        getInfo(userId).then(response => {
			
          this.user = response.data.data
          // this.roleGroup = response.roleGroup
          // this.postGroup = response.postGroup
        })
      },
	  goBack: uni.navigateBack,
    }
  }
</script>

<style lang="scss" scoped>
  @import "@/static/iconfont/iconfont.css";
  page {
    background-color: #ffffff;
  }
  .header {
  	display: flex;
  	justify-content: flex-start;
  	align-items: center;
  	width: 100%;
  	padding: 24upx;
  	box-sizing: border-box;
  	.title {
  		font-size: 30upx;
  		font-weight: bold;
  		margin-left: 24upx;
  		color: #333;
  	}
  }
  .container{
  	 background-color: #ffffff; /* 设置背景颜色 */
  	 height: 100vh; /* 确保背景覆盖整个页面 */
  	 width: 100vw;
  	 padding-top: var(--status-bar-height);
	}
</style>
